home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Mac Game Programming Gurus / TricksOfTheMacGameProgrammingGurus.iso / CodeWarrior Lite / Metrowerks C⁄C++ Lite / Headers / System Extras Headers / GX Headers / math routines.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-02  |  5.7 KB  |  165 lines  |  [TEXT/MMCC]

  1. /*
  2.     File:        math routines.h
  3.  
  4.     Copyright:    © 1984-1994 by Apple Computer, Inc., all rights reserved.
  5.  
  6.     WARNING
  7.     This file was auto generated by the interfacer tool. Modifications
  8.     must be made to the master file.
  9.  
  10. */
  11.  
  12. #ifndef mathRoutinesIncludes
  13. #define mathRoutinesIncludes
  14.  
  15.     #ifdef __powerc
  16.         #ifndef __FIXMATH__
  17.             #ifdef fixed1
  18.                 #undef fixed1
  19.                 #undef fract1
  20.             #endif
  21.  
  22. #include <FixMath.h>
  23. /*    #include <Types.h>                                            */
  24. /*        #include <ConditionalMacros.h>                            */
  25. /*        #include <MixedMode.h>                                    */
  26. /*            #include <Traps.h>                                    */
  27.         #endif
  28.  
  29.     #endif
  30.  
  31.     #ifndef mathTypesIncludes
  32. #include "math types.h"
  33.     #endif
  34.  
  35.     #ifndef graphicsLinkageIncludes
  36. #include "graphics linkage.h"
  37.     #endif
  38.  
  39.     #ifdef __cplusplus
  40. extern "C" {
  41.     #endif
  42.  
  43. extern gxMapping *CopyToMapping(gxMapping *target, const gxMapping *source)
  44.  THREEWORDINLINE(0x303C, 0x31, 0xA832);
  45. extern gxMapping *InvertMapping(gxMapping *target, const gxMapping *source)
  46.  THREEWORDINLINE(0x303C, 0x32, 0xA832);
  47. extern gxMapping *MapMapping(gxMapping *target, const gxMapping *source)
  48.  THREEWORDINLINE(0x303C, 0x33, 0xA832);
  49. extern gxMapping *MoveMapping(gxMapping *target, Fixed hOffset, Fixed vOffset)
  50.  THREEWORDINLINE(0x303C, 0x34, 0xA832);
  51. extern gxMapping *MoveMappingTo(gxMapping *target, Fixed hPosition, Fixed vPosition)
  52.  THREEWORDINLINE(0x303C, 0x35, 0xA832);
  53. extern gxMapping *NormalizeMapping(gxMapping *target)
  54.  THREEWORDINLINE(0x303C, 0x36, 0xA832);
  55. extern gxMapping *RotateMapping(gxMapping *target, Fixed angle, Fixed xCenter, Fixed yCenter)
  56.  THREEWORDINLINE(0x303C, 0x37, 0xA832);
  57. extern gxMapping *ScaleMapping(gxMapping *target, Fixed hFactor, Fixed vFactor, Fixed xCenter, Fixed yCenter)
  58.  THREEWORDINLINE(0x303C, 0x38, 0xA832);
  59. extern gxMapping *ResetMapping(gxMapping *target)
  60.  THREEWORDINLINE(0x303C, 0x39, 0xA832);
  61. extern gxMapping *SkewMapping(gxMapping *target, Fixed skewX, Fixed skewY, Fixed xCenter, Fixed yCenter)
  62.  THREEWORDINLINE(0x303C, 0x3a, 0xA832);
  63. extern void MapPoints(const gxMapping *source, long count, gxPoint vector[])
  64.  THREEWORDINLINE(0x303C, 0x3b, 0xA832);
  65. extern short FirstBit(unsigned long)
  66.  THREEWORDINLINE(0x303C, 0x3c, 0xA832);
  67. extern short WideScale(const wide *source)
  68.  THREEWORDINLINE(0x303C, 0x3d, 0xA832);
  69. extern short LinearRoot(Fixed first, Fixed last, fract t[])
  70.  THREEWORDINLINE(0x303C, 0x3e, 0xA832);
  71. extern short QuadraticRoot(Fixed first, Fixed control, Fixed last, fract t[])
  72.  THREEWORDINLINE(0x303C, 0x3f, 0xA832);
  73. extern gxPoint *PolarToPoint(const gxPolar *, gxPoint *)
  74.  THREEWORDINLINE(0x303C, 0x40, 0xA832);
  75. extern gxPolar *PointToPolar(const gxPoint *, gxPolar *)
  76.  THREEWORDINLINE(0x303C, 0x41, 0xA832);
  77. extern fract FractCubeRoot(fract source)
  78.  THREEWORDINLINE(0x303C, 0x42, 0xA832);
  79. extern fract FractDivide(fract dividend, fract divisor)
  80.  THREEWORDINLINE(0x303C, 0x43, 0xA832);
  81. extern fract FractMultiply(fract multiplicand, fract multiplier)
  82.  THREEWORDINLINE(0x303C, 0x44, 0xA832);
  83. extern fract FractSineCosine(Fixed degrees, fract *cosine)
  84.  THREEWORDINLINE(0x303C, 0x45, 0xA832);
  85. extern fract FractSquareRoot(fract source)
  86.  THREEWORDINLINE(0x303C, 0x46, 0xA832);
  87. extern Fixed FixedDivide(Fixed dividend, Fixed divisor)
  88.  THREEWORDINLINE(0x303C, 0x47, 0xA832);
  89. extern Fixed FixedMultiply(Fixed multiplicand, Fixed multiplier)
  90.  THREEWORDINLINE(0x303C, 0x48, 0xA832);
  91. extern long MultiplyDivide(long source, long multiplier, long divisor)
  92.  THREEWORDINLINE(0x303C, 0x49, 0xA832);
  93. extern unsigned long Magnitude(long deltaX, long deltaY)
  94.  THREEWORDINLINE(0x303C, 0x4a, 0xA832);
  95. extern long VectorMultiplyDivide(long count, const long *vector1, long step1, const long *vector2, long step2, long divisor)
  96.  THREEWORDINLINE(0x303C, 0x4b, 0xA832);
  97. #ifndef __powerc
  98. extern wide *WideAdd(wide *target, const wide *source)
  99.  THREEWORDINLINE(0x303C, 0x4c, 0xA832);
  100. extern short WideCompare(const wide *target, const wide *source)
  101.  THREEWORDINLINE(0x303C, 0x4d, 0xA832);
  102. extern wide *WideNegate(wide *target)
  103.  THREEWORDINLINE(0x303C, 0x4e, 0xA832);
  104. extern wide *WideShift(wide *target, long shift)
  105.  THREEWORDINLINE(0x303C, 0x4f, 0xA832);
  106. extern unsigned long WideSquareRoot(const wide *source)
  107.  THREEWORDINLINE(0x303C, 0x50, 0xA832);
  108. extern wide *WideSubtract(wide *target, const wide *source)
  109.  THREEWORDINLINE(0x303C, 0x51, 0xA832);
  110. extern wide *WideMultiply(long multiplicand, long multiplier, wide *target)
  111.  THREEWORDINLINE(0x303C, 0x52, 0xA832);
  112. extern long WideDivide(const wide *dividend, long divisor, long *remainder)
  113.  THREEWORDINLINE(0x303C, 0x53, 0xA832);
  114. #endif
  115.  
  116. extern wide *VectorMultiply(long count, const long *vector1, long step1, const long *vector2, long step2, wide *dot)
  117.  THREEWORDINLINE(0x303C, 0x54, 0xA832);
  118. #ifndef __powerc
  119. extern wide *WideWideDivide(wide *dividend, long divisor, long *remainder)
  120.  THREEWORDINLINE(0x303C, 0x55, 0xA832);
  121. #endif
  122.  
  123. extern unsigned long RandomBits(long count, long focus)
  124.  THREEWORDINLINE(0x303C, 0x56, 0xA832);
  125. extern void SetRandomSeed(const wide *seed)
  126.  THREEWORDINLINE(0x303C, 0x57, 0xA832);
  127. extern wide *GetRandomSeed(wide *seed)
  128.  THREEWORDINLINE(0x303C, 0x58, 0xA832);
  129.     #ifdef __cplusplus
  130. }
  131.     #endif
  132.  
  133. #define FixedRound(a) ((short)((Fixed)(a) + fixed1/2 >> 16))
  134.  
  135. #define FixedSquareRoot(a) ((Fixed)FractSquareRoot(a) + 64 >> 7)
  136.  
  137. #define FixedTruncate(a) ((short)((Fixed)(a) >> 16))
  138.  
  139. #define FixedToFract(a) ((fract)(a) << 14)
  140.  
  141. #define FractToFixed(a) ((Fixed)(a) + 8192L >> 14)
  142.  
  143. #define FixedToInt(a) ((short)((Fixed)(a) + fixed1/2 >> 16))
  144.  
  145. #define IntToFixed(a) ((Fixed)(a) << 16)
  146.  
  147. #define FixedToFloat(a) ((float)(a) / fixed1)
  148.  
  149. #define FloatToFixed(a) ((Fixed)((float)(a) * fixed1))
  150.  
  151. #define FractToFloat(a) ((float)(a) / fract1)
  152.  
  153. #define FloatToFract(a) ((fract)((float)(a) * fract1))
  154.  
  155. #define ColorToFract(a) (((fract) (a) << 14) + ((fract)(a) + 2 >> 2))
  156.  
  157. #define FractToColor(a) ((gxColorValue) ((a) - ((a) >> 16) + 8191 >> 14))
  158.  
  159. #define ff(a) IntToFixed(a)
  160.  
  161. #define fl(a) FloatToFixed(a)
  162.  
  163. #endif
  164.  
  165.